/**
 * React Router v6.4.2
 *
 * Copyright (c) Remix Software Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@remix-run/router"),require("react")):"function"==typeof define&&define.amd?define(["exports","@remix-run/router","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactRouter={},e.Router,e.React)}(this,(function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var a=n(r);function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o.apply(this,arguments)}const i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},{useState:u,useEffect:l,useLayoutEffect:s,useDebugValue:c}=a;function d(e){const t=e.getSnapshot,r=e.value;try{const e=t();return!i(r,e)}catch(e){return!0}}const p=!!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement)?function(e,t,r){return t()}:function(e,t,r){const n=t(),[{inst:a},o]=u({inst:{value:n,getSnapshot:t}});return s((()=>{a.value=n,a.getSnapshot=t,d(a)&&o({inst:a})}),[e,n,t]),l((()=>{d(a)&&o({inst:a});return e((()=>{d(a)&&o({inst:a})}))}),[e]),c(n),n},h="useSyncExternalStore"in a?(e=>e.useSyncExternalStore)(a):p,m=a.createContext(null),f=a.createContext(null),v=a.createContext(null),g=a.createContext(null),y=a.createContext(null),E=a.createContext(null),b=a.createContext({outlet:null,matches:[]}),x=a.createContext(null);function P(){return null!=a.useContext(E)}function R(){return P()||t.invariant(!1),a.useContext(E).location}function C(e){return e.filter(((t,r)=>0===r||!t.route.index&&t.pathnameBase!==e[r-1].pathnameBase))}function O(){P()||t.invariant(!1);let{basename:e,navigator:r}=a.useContext(y),{matches:n}=a.useContext(b),{pathname:o}=R(),i=JSON.stringify(C(n).map((e=>e.pathnameBase))),u=a.useRef(!1);return a.useEffect((()=>{u.current=!0})),a.useCallback((function(n,a){if(void 0===a&&(a={}),!u.current)return;if("number"==typeof n)return void r.go(n);let l=t.resolveTo(n,JSON.parse(i),o,"path"===a.relative);"/"!==e&&(l.pathname="/"===l.pathname?e:t.joinPaths([e,l.pathname])),(a.replace?r.replace:r.push)(l,a.state,a)}),[e,r,i,o])}const j=a.createContext(null);function S(e){let t=a.useContext(b).outlet;return t?a.createElement(j.Provider,{value:e},t):t}function D(e,r){let{relative:n}=void 0===r?{}:r,{matches:o}=a.useContext(b),{pathname:i}=R(),u=JSON.stringify(C(o).map((e=>e.pathnameBase)));return a.useMemo((()=>t.resolveTo(e,JSON.parse(u),i,"path"===n)),[e,u,i,n])}function _(e,r){P()||t.invariant(!1);let n=a.useContext(v),{matches:i}=a.useContext(b),u=i[i.length-1],l=u?u.params:{};!u||u.pathname;let s=u?u.pathnameBase:"/";u&&u.route;let c,d=R();if(r){var p;let e="string"==typeof r?t.parsePath(r):r;"/"===s||(null==(p=e.pathname)?void 0:p.startsWith(s))||t.invariant(!1),c=e}else c=d;let h=c.pathname||"/",m="/"===s?h:h.slice(s.length)||"/",f=t.matchRoutes(e,{pathname:m}),g=N(f&&f.map((e=>Object.assign({},e,{params:Object.assign({},l,e.params),pathname:t.joinPaths([s,e.pathname]),pathnameBase:"/"===e.pathnameBase?s:t.joinPaths([s,e.pathnameBase])}))),i,n||void 0);return r?a.createElement(E.Provider,{value:{location:o({pathname:"/",search:"",hash:"",state:null,key:"default"},c),navigationType:t.Action.Pop}},g):g}function U(){let e=B(),r=t.isRouteErrorResponse(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,o="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:o},u={padding:"2px 4px",backgroundColor:o};return a.createElement(a.Fragment,null,a.createElement("h2",null,"Unhandled Thrown Error!"),a.createElement("h3",{style:{fontStyle:"italic"}},r),n?a.createElement("pre",{style:i},n):null,a.createElement("p",null,"💿 Hey developer 👋"),a.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",a.createElement("code",{style:u},"errorElement")," props on ",a.createElement("code",{style:u},"<Route>")))}class A extends a.Component{constructor(e){super(e),this.state={location:e.location,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location?{error:e.error,location:e.location}:{error:e.error||t.error,location:t.location}}componentDidCatch(e,t){console.error("React Router caught the following error during render",e,t)}render(){return this.state.error?a.createElement(x.Provider,{value:this.state.error,children:this.props.component}):this.props.children}}function w(e){let{routeContext:t,match:r,children:n}=e,o=a.useContext(m);return o&&r.route.errorElement&&(o._deepestRenderedBoundaryId=r.route.id),a.createElement(b.Provider,{value:t},n)}function N(e,r,n){if(void 0===r&&(r=[]),null==e){if(null==n||!n.errors)return null;e=n.matches}let o=e,i=null==n?void 0:n.errors;if(null!=i){let e=o.findIndex((e=>e.route.id&&(null==i?void 0:i[e.route.id])));e>=0||t.invariant(!1),o=o.slice(0,Math.min(o.length,e+1))}return o.reduceRight(((e,t,u)=>{let l=t.route.id?null==i?void 0:i[t.route.id]:null,s=n?t.route.errorElement||a.createElement(U,null):null,c=()=>a.createElement(w,{match:t,routeContext:{outlet:e,matches:r.concat(o.slice(0,u+1))}},l?s:void 0!==t.route.element?t.route.element:e);return n&&(t.route.errorElement||0===u)?a.createElement(A,{location:n.location,component:s,error:l,children:c()}):c()}),null)}var M,F,T;function k(e){let r=a.useContext(v);return r||t.invariant(!1),r}function B(){var e;let r=a.useContext(x),n=k(F.UseRouteError),o=a.useContext(b),i=o.matches[o.matches.length-1];return r||(o||t.invariant(!1),i.route.id||t.invariant(!1),null==(e=n.errors)?void 0:e[i.route.id])}function L(){let e=a.useContext(g);return null==e?void 0:e._data}function H(e){t.invariant(!1)}function I(e){let{basename:r="/",children:n=null,location:o,navigationType:i=t.Action.Pop,navigator:u,static:l=!1}=e;P()&&t.invariant(!1);let s=r.replace(/^\/*/,"/"),c=a.useMemo((()=>({basename:s,navigator:u,static:l})),[s,u,l]);"string"==typeof o&&(o=t.parsePath(o));let{pathname:d="/",search:p="",hash:h="",state:m=null,key:f="default"}=o,v=a.useMemo((()=>{let e=t.stripBasename(d,s);return null==e?null:{pathname:e,search:p,hash:h,state:m,key:f}}),[s,d,p,h,m,f]);return null==v?null:a.createElement(y.Provider,{value:c},a.createElement(E.Provider,{children:n,value:{location:v,navigationType:i}}))}function J(e){let{children:t,location:r}=e,n=a.useContext(f);return _(n&&!t?n.router.routes:W(t),r)}!function(e){e.UseRevalidator="useRevalidator"}(M||(M={})),function(e){e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator"}(F||(F={})),function(e){e[e.pending=0]="pending",e[e.success=1]="success",e[e.error=2]="error"}(T||(T={}));const z=new Promise((()=>{}));class V extends a.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error("<Await> caught the following error during render",e,t)}render(){let{children:e,errorElement:r,resolve:n}=this.props,o=null,i=T.pending;if(n instanceof Promise)if(this.state.error){i=T.error;let e=this.state.error;o=Promise.reject().catch((()=>{})),Object.defineProperty(o,"_tracked",{get:()=>!0}),Object.defineProperty(o,"_error",{get:()=>e})}else n._tracked?(o=n,i=void 0!==o._error?T.error:void 0!==o._data?T.success:T.pending):(i=T.pending,Object.defineProperty(n,"_tracked",{get:()=>!0}),o=n.then((e=>Object.defineProperty(n,"_data",{get:()=>e})),(e=>Object.defineProperty(n,"_error",{get:()=>e}))));else i=T.success,o=Promise.resolve(),Object.defineProperty(o,"_tracked",{get:()=>!0}),Object.defineProperty(o,"_data",{get:()=>n});if(i===T.error&&o._error instanceof t.AbortedDeferredError)throw z;if(i===T.error&&!r)throw o._error;if(i===T.error)return a.createElement(g.Provider,{value:o,children:r});if(i===T.success)return a.createElement(g.Provider,{value:o,children:e});throw o}}function q(e){let{children:t}=e,r=L();return"function"==typeof t?t(r):a.createElement(a.Fragment,null,t)}function W(e,r){void 0===r&&(r=[]);let n=[];return a.Children.forEach(e,((e,o)=>{if(!a.isValidElement(e))return;if(e.type===a.Fragment)return void n.push.apply(n,W(e.props.children,r));e.type!==H&&t.invariant(!1),e.props.index&&e.props.children&&t.invariant(!1);let i=[...r,o],u={id:e.props.id||i.join("-"),caseSensitive:e.props.caseSensitive,element:e.props.element,index:e.props.index,path:e.props.path,loader:e.props.loader,action:e.props.action,errorElement:e.props.errorElement,hasErrorBoundary:null!=e.props.errorElement,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle};e.props.children&&(u.children=W(e.props.children,i)),n.push(u)})),n}function X(e){return e.map((e=>{let t=o({},e);return null==t.hasErrorBoundary&&(t.hasErrorBoundary=null!=t.errorElement),t.children&&(t.children=X(t.children)),t}))}Object.defineProperty(e,"AbortedDeferredError",{enumerable:!0,get:function(){return t.AbortedDeferredError}}),Object.defineProperty(e,"NavigationType",{enumerable:!0,get:function(){return t.Action}}),Object.defineProperty(e,"createPath",{enumerable:!0,get:function(){return t.createPath}}),Object.defineProperty(e,"defer",{enumerable:!0,get:function(){return t.defer}}),Object.defineProperty(e,"generatePath",{enumerable:!0,get:function(){return t.generatePath}}),Object.defineProperty(e,"isRouteErrorResponse",{enumerable:!0,get:function(){return t.isRouteErrorResponse}}),Object.defineProperty(e,"json",{enumerable:!0,get:function(){return t.json}}),Object.defineProperty(e,"matchPath",{enumerable:!0,get:function(){return t.matchPath}}),Object.defineProperty(e,"matchRoutes",{enumerable:!0,get:function(){return t.matchRoutes}}),Object.defineProperty(e,"parsePath",{enumerable:!0,get:function(){return t.parsePath}}),Object.defineProperty(e,"redirect",{enumerable:!0,get:function(){return t.redirect}}),Object.defineProperty(e,"resolvePath",{enumerable:!0,get:function(){return t.resolvePath}}),e.Await=function(e){let{children:t,errorElement:r,resolve:n}=e;return a.createElement(V,{resolve:n,errorElement:r},a.createElement(q,null,t))},e.MemoryRouter=function(e){let{basename:r,children:n,initialEntries:o,initialIndex:i}=e,u=a.useRef();null==u.current&&(u.current=t.createMemoryHistory({initialEntries:o,initialIndex:i,v5Compat:!0}));let l=u.current,[s,c]=a.useState({action:l.action,location:l.location});return a.useLayoutEffect((()=>l.listen(c)),[l]),a.createElement(I,{basename:r,children:n,location:s.location,navigationType:s.action,navigator:l})},e.Navigate=function(e){let{to:r,replace:n,state:o,relative:i}=e;P()||t.invariant(!1);let u=a.useContext(v),l=O();return a.useEffect((()=>{u&&"idle"!==u.navigation.state||l(r,{replace:n,state:o,relative:i})})),null},e.Outlet=function(e){return S(e.context)},e.Route=H,e.Router=I,e.RouterProvider=function(e){let{fallbackElement:t,router:r}=e,n=h(r.subscribe,(()=>r.state),(()=>r.state)),o=a.useMemo((()=>({createHref:r.createHref,go:e=>r.navigate(e),push:(e,t,n)=>r.navigate(e,{state:t,preventScrollReset:null==n?void 0:n.preventScrollReset}),replace:(e,t,n)=>r.navigate(e,{replace:!0,state:t,preventScrollReset:null==n?void 0:n.preventScrollReset})})),[r]),i=r.basename||"/";return a.createElement(f.Provider,{value:{router:r,navigator:o,static:!1,basename:i}},a.createElement(v.Provider,{value:n},a.createElement(I,{basename:r.basename,location:r.state.location,navigationType:r.state.historyAction,navigator:o},r.state.initialized?a.createElement(J,null):t)))},e.Routes=J,e.UNSAFE_DataRouterContext=f,e.UNSAFE_DataRouterStateContext=v,e.UNSAFE_DataStaticRouterContext=m,e.UNSAFE_LocationContext=E,e.UNSAFE_NavigationContext=y,e.UNSAFE_RouteContext=b,e.UNSAFE_enhanceManualRouteObjects=X,e.createMemoryRouter=function(e,r){return t.createRouter({basename:null==r?void 0:r.basename,history:t.createMemoryHistory({initialEntries:null==r?void 0:r.initialEntries,initialIndex:null==r?void 0:r.initialIndex}),hydrationData:null==r?void 0:r.hydrationData,routes:X(e)}).initialize()},e.createRoutesFromChildren=W,e.createRoutesFromElements=W,e.renderMatches=function(e){return N(e)},e.useActionData=function(){let e=k(F.UseActionData);return a.useContext(b)||t.invariant(!1),Object.values((null==e?void 0:e.actionData)||{})[0]},e.useAsyncError=function(){let e=a.useContext(g);return null==e?void 0:e._error},e.useAsyncValue=L,e.useHref=function(e,r){let{relative:n}=void 0===r?{}:r;P()||t.invariant(!1);let{basename:o,navigator:i}=a.useContext(y),{hash:u,pathname:l,search:s}=D(e,{relative:n}),c=l;return"/"!==o&&(c="/"===l?o:t.joinPaths([o,l])),i.createHref({pathname:c,search:s,hash:u})},e.useInRouterContext=P,e.useLoaderData=function(){let e=k(F.UseLoaderData),r=a.useContext(b);r||t.invariant(!1);let n=r.matches[r.matches.length-1];return n.route.id||t.invariant(!1),e.loaderData[n.route.id]},e.useLocation=R,e.useMatch=function(e){P()||t.invariant(!1);let{pathname:r}=R();return a.useMemo((()=>t.matchPath(e,r)),[r,e])},e.useMatches=function(){let{matches:e,loaderData:t}=k(F.UseMatches);return a.useMemo((()=>e.map((e=>{let{pathname:r,params:n}=e;return{id:e.route.id,pathname:r,params:n,data:t[e.route.id],handle:e.route.handle}}))),[e,t])},e.useNavigate=O,e.useNavigation=function(){return k(F.UseNavigation).navigation},e.useNavigationType=function(){return a.useContext(E).navigationType},e.useOutlet=S,e.useOutletContext=function(){return a.useContext(j)},e.useParams=function(){let{matches:e}=a.useContext(b),t=e[e.length-1];return t?t.params:{}},e.useResolvedPath=D,e.useRevalidator=function(){let e=function(e){let r=a.useContext(f);return r||t.invariant(!1),r}(M.UseRevalidator),r=k(F.UseRevalidator);return{revalidate:e.router.revalidate,state:r.revalidation}},e.useRouteError=B,e.useRouteLoaderData=function(e){return k(F.UseRouteLoaderData).loaderData[e]},e.useRoutes=_,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=react-router.production.min.js.map
